#include <limits.h>
#include "matrix.h"
#include "../gtest-1.7.0/include/gtest/gtest.h"

TEST(AddTest, Blah) {
	
	int **result;
	int **test_arr1, **test_arr2, **expt_arr;
	test_arr1 = new int *[5];
	test_arr2 = new int *[5];
	expt_arr = new int *[5];
	result=new int *[5];
	for (int i = 0; i < 5; i++)
	{
		test_arr1[i] = new int[5];
		test_arr2[i] = new int[5];
		expt_arr[i] = new int[5];
		result[i]=new int [5];
	}

	for (int i = 0; i<5; i++)
	{
		for (int j = 0; j<5; j++)
		{
			test_arr1[i][j] = 1;
			test_arr2[i][j] = 2;
			expt_arr[i][j] = 3;
		}
	}
	matrix obj;
	obj.matrixAdd(test_arr1,test_arr2,result,5,5,5,5);

	for (int i=0; i<5; i++) {
		for (int j=0; j<5; j++) {
			EXPECT_EQ(result[i][j], expt_arr[i][j]);
		}
	}
}


TEST(SUBTRACTTest, Blah) {
	int **result;
	int **test_arr1, **test_arr2, **expt_arr;
	test_arr1 = new int *[5];
	test_arr2 = new int *[5];
	expt_arr = new int *[5];
	result=new int *[5];
	for (int i = 0; i < 5; i++)
	{
		test_arr1[i] = new int[5];
		test_arr2[i] = new int[5];
		expt_arr[i] = new int[5];
		result[i]=new int [5];
	}

	for (int i = 0; i<5; i++)
	{
		for (int j = 0; j<5; j++)
		{
			test_arr1[i][j] = 3;
			test_arr2[i][j] = 2;
			expt_arr[i][j] = 1;
		}
	}
	matrix obj2;
	obj2.matrixSubtract(test_arr1,test_arr2,result,5,5,5,5);

	for (int i=0; i<5; i++) {
		for (int j=0; j<5; j++) {
			EXPECT_EQ(result[i][j], expt_arr[i][j]);
		}
	}
}

TEST(MULTIPLYTest, Blah) {
	int **result;
	int **test_arr1, **test_arr2, **expt_arr;
	test_arr1 = new int *[5];
	test_arr2 = new int *[5];
	expt_arr = new int *[5];
	result=new int *[5];
	for (int i = 0; i < 5; i++)
	{
		test_arr1[i] = new int[5];
		test_arr2[i] = new int[5];
		expt_arr[i] = new int[5];
		result[i]=new int [5];
	}

	for (int i = 0; i<5; i++)
	{
		for (int j = 0; j<5; j++)
		{
			test_arr1[i][j] = 1;
			test_arr2[i][j] = 1;
			expt_arr[i][j] = 5;
		}
	}
	matrix obj3;
	obj3.matrixMultiply(test_arr1,test_arr2,result,5,5,5,5);

	for (int i=0; i<5; i++) {
		for (int j=0; j<5; j++) {
			EXPECT_EQ(result[i][j], expt_arr[i][j]);
		}
	}
}
